// history模式

// createWebHashHistory hash模式
// createWebHistory  history模式
import {
    createRouter,
    createWebHistory,
} from 'vue-router'

import login from '../Login/login'
import home from '../Home/home'
import homes from '../Home/homes'
import recycle from '../Home/recycle'
import transaction from '../Home/transaction'
import maintenance from '../Home/maintenance'



const routes = [
    // 路由的默认路径
    {
        path: '/',
        redirect: "/login"
    },
    {
        path: '/login',
        component: login,
        name:'login'
    },
    {
        path:'/home',
        component:home,
        name:'home',
        children:[
            {
                path:'/homes',
                component:homes,
                name:'homes'
            },
            {
                path:'/recycle',
                component:recycle,
                name:'recycle'
            },
            {
                path:'/transaction',
                component:transaction,
                name:'transaction'
            },
            {
                path:'/maintenance',
                component:maintenance,
                name:'maintenance'
            },

        ],
        redirect: "/homes"
    }
]

// 创建路由对象
const router = createRouter({
    history: createWebHistory(),
    routes
})
export default router;
